home *** CD-ROM | disk | FTP | other *** search
/ Champak 106 / Vol 106.iso / games / global_r.swf / scripts / __Packages / Interface.as < prev    next >
Encoding:
Text File  |  2010-04-12  |  2.2 KB  |  75 lines

  1. class Interface extends MovieClip
  2. {
  3.    var btnPlay;
  4.    var mcControl;
  5.    var btnInstructions;
  6.    var btnSend;
  7.    var btnHighScore;
  8.    var oSpaceLst;
  9.    var mcInstructionsPanel;
  10.    static var instance;
  11.    function Interface(Void)
  12.    {
  13.       super();
  14.       Interface.instance = this;
  15.       this.btnPlay = this.mcControl.btnPlay;
  16.       this.btnInstructions = this.mcControl.btnInstructions;
  17.       this.btnSend = this.mcControl.btnSend;
  18.       this.btnHighScore = this.mcControl.btnHighScore;
  19.       this.btnPlay.onRelease = mx.utils.Delegate.create(this,this.onReleasePlay);
  20.       this.btnInstructions.onRelease = mx.utils.Delegate.create(this,this.onReleaseInstructions);
  21.       this.btnSend.onRelease = mx.utils.Delegate.create(this,this.onReleaseSend);
  22.       this.btnHighScore.onRelease = mx.utils.Delegate.create(this,this.onReleaseHighScore);
  23.       this.oSpaceLst = new Object();
  24.       this.oSpaceLst.onKeyDown = mx.utils.Delegate.create(this,this.onPressSpace);
  25.       Key.addListener(this.oSpaceLst);
  26.    }
  27.    static function getInstance(Void)
  28.    {
  29.       return Interface.instance;
  30.    }
  31.    function onReleasePlay(Void)
  32.    {
  33.       Key.removeListener(this.oSpaceLst);
  34.       _root.gotoAndPlay("gameIn");
  35.    }
  36.    function onReleaseInstructions(Void)
  37.    {
  38.       Key.removeListener(this.oSpaceLst);
  39.       this.mcInstructionsPanel.btnBack.onRelease = mx.utils.Delegate.create(this,this.onReleaseInstrBack);
  40.       this.gotoAndPlay("instructionsIn");
  41.    }
  42.    function onReleaseSend(Void)
  43.    {
  44.       Key.removeListener(this.oSpaceLst);
  45.       this.gotoAndPlay("sendIn");
  46.    }
  47.    function onReleaseHighScore(Void)
  48.    {
  49.       Key.removeListener(this.oSpaceLst);
  50.       this.gotoAndPlay("highIn");
  51.    }
  52.    function onReleaseInstrBack(Void)
  53.    {
  54.       Key.addListener(this.oSpaceLst);
  55.       this.gotoAndPlay("instructionsOut");
  56.    }
  57.    function onReleaseSendBack(Void)
  58.    {
  59.       Key.addListener(this.oSpaceLst);
  60.       this.gotoAndPlay("sendOut");
  61.    }
  62.    function onReleaseScoreBack(Void)
  63.    {
  64.       Key.addListener(this.oSpaceLst);
  65.       this.gotoAndPlay("highOut");
  66.    }
  67.    function onPressSpace(Void)
  68.    {
  69.       if(Key.isDown(32))
  70.       {
  71.          this.onReleasePlay();
  72.       }
  73.    }
  74. }
  75.